/*
 * @Description: 地图相关样式 如标记点 线等
 * @Author: liushuang
 * @Date: 2022-05-10 10:08:43
 * @LastEditTime: 2022-11-09 14:19:29
 */
@use 'sass:math';
:root {
  --show-marker: showMarkerAnimation 0.1s forwards;
  --hide-marker: hideMarkerAnimation 0.1s forwards;
  --faceMarkerAnimation: var(--show-marker);
  --videoMarkerAnimation: var(--show-marker);
  --faceMarkerAlarmAnimation: var(--show-marker);
  --infoWindoAnimation: var(--show-marker);
}

.amap-marker {
  // 标记点文本样式
  .amap-marker-label {
    border: none;
    padding: 0;
    background-color: transparent;
  }
  .videoMarker:not(.cluster) {
    &:hover {
      .title {
        width: auto;
        overflow: visible;
        box-shadow: 1px 1px 10px rgba(55, 69, 96, 0.8);
      }
    }
  }
  .videoMarker.mainNode {
    animation: mainNodeAnimation 1s forwards infinite;
    &:hover {
      animation: none;
    }
  }
  @keyframes mainNodeAnimation {
    0% {
      box-shadow: 0 0 0px 0px #fff;
    }
    100% {
      box-shadow: 0 0 0px 20px transparent;
    }
  }
  // 标记点
  .faceMarkerAlarm,
  .faceMarker,
  .videoMarker {
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 14px;
    height: 24px;
    transition: all 0.2s;
    border-radius: 4px;
    &:hover {
      .title {
        box-shadow: 1px 1px 10px rgba(55, 69, 96, 0.8);
      }
    }
    &:active {
      transform: scale(0.9);
    }
    .icon {
      height: 100%;
      width: 24px;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      position: relative;
      z-index: 2;
    }
    .title {
      box-shadow: 1px 1px 5px rgba(55, 69, 96, 0.8);
      transition: all 0.2s;
      height: 100%;
      line-height: 24px;
      padding: 0 8px;
      box-sizing: border-box;
      background: rgba(55, 69, 96, 0.8);
      flex-shrink: 0;
      border-radius: 4px;
      position: relative;
      z-index: 1;
      transform: translateX(-3px);
      width: 80px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  // 人脸布控
  .faceMarker {
    animation: var(--faceMarkerAnimation);
    .icon {
      background: linear-gradient(180deg, #f7cb5b 0%, #f75b5b 100%);
      box-shadow: -1px 1px 5px #f75b5b;
    }
  }
  // 视频
  .videoMarker.cluster {
    .icon {
      background: #ae7be5 !important;
      box-shadow: -1px 1px 5px #ae7be5;
    }
    .title {
      width: auto !important;
    }
  }
  .videoMarker.cluster.showSetting {
    .icon {
      background: #98e61b !important;
      box-shadow: -1px 1px 5px #98e61b;
    }
    .title {
      width: auto !important;
    }
  }
  .videoMarker.cluster.alarm {
    .icon {
      background: #f75b5b !important;
      box-shadow: -1px 1px 5px #f75b5b;
    }
    .title {
      width: auto !important;
    }
  }
  .videoMarker {
    animation: var(--videoMarkerAnimation);
    .icon {
      background: linear-gradient(180deg, #69e0fc 0%, #4f92e2 100%);
      box-shadow: -1px 1px 5px #4f92e2;
    }
  }
  .videoMarker.showSetting {
    animation: var(--videoMarkerAnimation);
    .icon {
      background: linear-gradient(180deg, #39eb51 0%, #03ad2e 100%);
      box-shadow: -1px 1px 5px #03ad2e;
    }
  }
  // 人脸布控警告
  .faceMarkerAlarm {
    animation: var(--faceMarkerAlarmAnimation);
  }
  // 警告动画
  .alarm {
    .icon {
      background: linear-gradient(180deg, #f38989 0%, #e24f4f 100%);
      box-shadow: -1px 1px 5px #e24f4f;
    }
    &::after {
      content: '';
      position: absolute;
      left: 1px;
      bottom: 1px;
      border-radius: 50%;
      width: 22px;
      height: 22px;
      animation: alarmAnimation 1s infinite linear;
    }
  }
  // 已处理警告
  .treatedMarker {
    .icon {
      background: linear-gradient(180deg, #89f38e 0%, #4fe24f 100%);
      box-shadow: -1px 1px 5px #4fe24f;
    }
    &::after {
      animation: none !important;
    }
  }
  @keyframes alarmAnimation {
    0% {
      box-shadow: 0 0 0px 0px #e24f4f;
      // opacity: 1;
      // transform: scale(1.1);
    }
    100% {
      // opacity: 0.5;
      // transform: scale(1);
      box-shadow: 0 0 0 22px transparent;
    }
  }
  // 地图警告详细信息弹窗
  .alarmDialogContent {
    width: 300px;
    color: #cad1dc;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    padding: 5px;
    border-radius: 4px;
    overflow: hidden;
    background: linear-gradient(
      180deg,
      rgba(55, 69, 96, 0.6) 0%,
      rgba(55, 69, 96, 0.4) 100%
    );
    box-shadow: 2px 2px 5px rgb(55 69 96 / 10%);
    .alarmDialogContainer {
      box-sizing: border-box;
      padding: 0 10px;
      border-radius: 4px;
      width: 100%;
      height: 100%;
      background: rgba(55, 69, 96, 0.9);
      // background: rgba(226, 105, 105, 0.9);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      position: relative;
      .alarmTitle {
        color: #fff;
        font-size: 16px;
        padding: 5px 0;
      }
      .alarmCloseIcon {
        position: absolute;
        padding: 5px 14px;
        right: 0px;
        top: 0px;
        transition: all 0.2s;
        cursor: pointer;
        &:hover {
          background: #f75b5b;
          color: #fff;
        }
      }
      .alarmInfoOption {
        padding: 2px 0;
      }
      .alarmBtns {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 0;
        .alarmBtn {
          border: 1px solid #cad1dc;
          font-size: 12px;
          box-sizing: border-box;
          width: 78px;
          height: 28px;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: 4px;
          cursor: pointer;
          transition: all 0.2s;
          &:hover {
            color: #fff;
            border-color: #fff;
            border-radius: 8px;
          }
        }
      }
    }
  }
  // 消防栓样式
  .fireTagMarker {
    color: rgb(255, 49, 49);
    font-size: 20px;
  }
  // 火警样式
  $fireColor: rgb(255, 80, 0);
  $fireColorT: rgba(255, 80, 0, 0);
  $dur: 1s;
  $blur: 0.1px;
  $fireRad: 15px;
  $parts: 31;
  $partSize: 25px;
  .fire-wrap {
    // transform: scale(0.5);
    position: absolute;
  }
  .fire {
    font-size: 24px;
    filter: blur($blur);
    -webkit-filter: blur($blur);
    position: relative;
    width: 50px;
    height: 60px;
  }
  .particle {
    animation: rise $dur ease-in infinite;
    background-image: radial-gradient($fireColor 20%, $fireColorT 70%);
    border-radius: 50%;
    mix-blend-mode: screen;
    opacity: 0;
    position: absolute;
    bottom: 0;
    width: $partSize;
    height: $partSize;
    // spread particles out in time and x-position to get desired effect
    @for $p from 1 through $parts {
      &:nth-of-type(#{$p}) {
        animation-delay: $dur * random();
        left: calc((100% - #{$partSize}) * #{math.div(($p - 1), $parts)});
      }
    }
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(0) scale(1);
    }
    25% {
      opacity: 1;
    }
    to {
      opacity: 0;
      transform: translateY(-50px) scale(0);
    }
  }
  @keyframes showMarkerAnimation {
    0% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }
  @keyframes hideMarkerAnimation {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}
// 巡逻人员标记点样式
.patrolPeople {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  .title {
    background: rgba(55, 69, 96, 0.9);
    box-shadow: 1px 1px 10px rgba(55, 69, 96, 0.8);
    border-radius: 4px;
    margin-bottom: 4px;
    overflow: hidden;
    .name {
      // width: 36px;
      line-height: 14px;
      box-sizing: border-box;
      padding: 0 5px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 12px;
      white-space: nowrap;
      position: relative;
      .closeBtn {
        margin-left: 5px;
        padding: 3px 4px;
        transition: all 0.2s;
        border-radius: 2px;
        cursor: pointer;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        &:hover {
          background: #f75b5b;
          color: #fff;
        }
      }
    }
    .remarkBtn {
      height: 20px;
      padding: 0 5px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #4f92e2;
      color: #fff;
      font-size: 12px;
    }
    .hide {
      display: none;
    }
  }
  img {
    width: 24px;
    height: auto;
  }
  img.hasBorder {
    width: 30px;
    height: auto;
    box-sizing: border-box;
    padding: 2px;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0px 0px 5px #fff;
    &.alarmAnimation {
      animation: alarmAnimation 1s infinite linear;
    }
  }
}

.amap-info {
  .videoClusterInfoWindow.alarm {
    background: rgba($color: #f75b5b, $alpha: 0.5);
    color: #fff;
    .infoWindowContainer {
      background: rgba($color: #f75b5b, $alpha: 0.5);
      .info-option {
        transition: all 0.1s;
        &:hover {
          background: #fff;
          color: #f75b5b;
        }
      }
    }
  }
  // 摄像头聚合点弹窗样式
  .videoClusterInfoWindow {
    animation: var(--infoWindoAnimation);
    background: linear-gradient(
      180deg,
      rgba(55, 69, 96, 0.6) 0%,
      rgba(55, 69, 96, 0.4) 100%
    );
    box-shadow: 2px 2px 5px rgb(55 69 96 / 10%);
    border-radius: 4px;
    height: 200px;
    width: 300px;
    box-sizing: border-box;
    overflow: hidden;
    padding: 5px;
    color: #cad1dc;
    .infoWindowContainer {
      box-sizing: border-box;
      padding-top: 0px;
      border-radius: 4px;
      width: 100%;
      height: 100%;
      background: rgba(55, 69, 96, 0.9);
      // overflow: auto;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      position: relative;
      .close-icon {
        position: absolute;
        padding: 5px 14px;
        right: 0px;
        top: 0px;
        transition: all 0.2s;
        cursor: pointer;
        &:hover {
          background: #f75b5b;
          color: #fff;
        }
      }
      .info-header,
      .info-option {
        flex-shrink: 0;
        height: 30px;
        width: 100%;
        display: flex;
        align-items: center;
        font-size: 14px;
        & > span:first-child {
          width: 48px;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          box-sizing: border-box;
        }
        & > span:nth-child(2) {
          flex: 1;
          height: 100%;
          display: flex;
          align-items: center;
          box-sizing: border-box;
          padding-left: 10px;
        }
        .video-icon {
          height: 100%;
          padding: 0 10px;
          box-sizing: border-box;
          margin-right: 5px;
          cursor: pointer;
          display: flex;
          align-items: center;
          transition: all 0.2s;
          &:hover {
            color: #4f92e2;
          }
        }
      }
      .info-option {
        height: auto;
        cursor: pointer;
        transition: all 0.2s;
        &:hover {
          background: #62708e;
        }
      }
    }
  }
  /* 滚动条样式 */
  .infoWindowContainer::-webkit-scrollbar {
    width: 6px;
    height: 8px;
    position: absolute !important;
    /**/
  }
  .infoWindowContainer::-webkit-scrollbar-track {
    background: transparent;
  }
  .infoWindowContainer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    transition: background 0.5s;
  }
  .infoWindowContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.9);
  }
}

.gateOptionMarker {
  color: #e24f4f;
  font-size: 25px;
  text-shadow: -1px 1px 5px #e24f4f;
  transition: all 0.1s;
}

.gateOptionLabel {
  border: none;
  background: rgba($color: #333, $alpha: 0.8);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  box-shadow: 1px 1px 5px rgba($color: #333, $alpha: 0.8);
}

.roadNameMarker {
  border: none;
  white-space: nowrap;
  background: rgba($color: #333, $alpha: 0.7);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  font-size: 16px;
  line-height: 17px;
  box-shadow: 1px 1px 5px rgba($color: #333, $alpha: 0.6);
  transform: translate(-50%, -50%);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  .main {
    content: '';
    height: 100%;
    width: 4px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0px;
    opacity: 0.9;
  }
}

.schoolOptionMarker {
  color: #e24f4f;
  font-size: 30px;
  text-shadow: -1px 1px 5px #e24f4f;
  transition: all 0.1s;
  &:hover {
    color: #4f92e2;
    text-shadow: -1px 1px 5px #4f92e2;
  }
}

.schoolOptionLabel {
  border: none;
  background: rgba($color: #333, $alpha: 0.8);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  box-shadow: 1px 1px 5px rgba($color: #333, $alpha: 0.8);
}

.buildingOptionMarker {
  color: #4f92e2;
  font-size: 30px;
  text-shadow: -1px 1px 5px #4f92e2;
  transition: all 0.1s;
}

.buildingOptionLabel {
  border: none;
  background: rgba($color: #333, $alpha: 0.8);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  box-shadow: 1px 1px 5px rgba($color: #333, $alpha: 0.8);
}

.areaNameMarker {
  border: none;
  white-space: nowrap;
  background: rgba($color: #333, $alpha: 0.7);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  font-size: 16px;
  line-height: 17px;
  box-shadow: 1px 1px 5px rgba($color: #333, $alpha: 0.6);
  transform: translate(-50%, -50%);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  .main {
    content: '';
    height: 100%;
    width: 4px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0px;
    opacity: 0.9;
  }
}
